package generator.domain;

import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName user_course_enrollments
 */
@Data
public class UserCourseEnrollments {
    /**
     * 报名记录主键
     */
    private Integer id;

    /**
     * 关联用户ID（业务层校验）
     */
    private Integer userId;

    /**
     * 关联课程ID（业务层校验）
     */
    private Integer courseId;

    /**
     * 关联订单ID（业务层校验，可为空如免费课程）
     */
    private Integer orderId;

    /**
     * 报名时间
     */
    private LocalDateTime enrollmentTime;

    /**
     * 有效期（NULL表示永久有效）
     */
    private LocalDateTime expiryTime;

    /**
     * 报名状态
     */
    private Object status;

    /**
     * 最后学习时间
     */
    private LocalDateTime lastLearnTime;

    /**
     * 学习进度（百分比）
     */
    private Integer progress;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserCourseEnrollments other = (UserCourseEnrollments) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getCourseId() == null ? other.getCourseId() == null : this.getCourseId().equals(other.getCourseId()))
            && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
            && (this.getEnrollmentTime() == null ? other.getEnrollmentTime() == null : this.getEnrollmentTime().equals(other.getEnrollmentTime()))
            && (this.getExpiryTime() == null ? other.getExpiryTime() == null : this.getExpiryTime().equals(other.getExpiryTime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getLastLearnTime() == null ? other.getLastLearnTime() == null : this.getLastLearnTime().equals(other.getLastLearnTime()))
            && (this.getProgress() == null ? other.getProgress() == null : this.getProgress().equals(other.getProgress()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getCourseId() == null) ? 0 : getCourseId().hashCode());
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        result = prime * result + ((getEnrollmentTime() == null) ? 0 : getEnrollmentTime().hashCode());
        result = prime * result + ((getExpiryTime() == null) ? 0 : getExpiryTime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getLastLearnTime() == null) ? 0 : getLastLearnTime().hashCode());
        result = prime * result + ((getProgress() == null) ? 0 : getProgress().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", courseId=").append(courseId);
        sb.append(", orderId=").append(orderId);
        sb.append(", enrollmentTime=").append(enrollmentTime);
        sb.append(", expiryTime=").append(expiryTime);
        sb.append(", status=").append(status);
        sb.append(", lastLearnTime=").append(lastLearnTime);
        sb.append(", progress=").append(progress);
        sb.append("]");
        return sb.toString();
    }
}